package com.ficus.road.maintain.authority.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.ficus.road.maintain.authority.interfaces.PasswordUpdate;
import com.ficus.road.maintain.authority.interfaces.UserUpdate;
import com.ficus.road.maintain.authority.interfaces.UserVerify;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author xiawen yang
 * @date 2021/8/27 下午3:57
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserUpdateVO {

    @NotNull(message = "用户名不能为空", groups = {UserUpdate.class, UserVerify.class})
    private String userName;

    private List<String> carIdList;

    @NotNull(message = "不能为空", groups = UserUpdate.class)
    private List<String> roles;

    //反序列化时，密码不读取
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @NotNull(message = "密码不能为空", groups = {PasswordUpdate.class, UserVerify.class})
    private String password;
}
